home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: Pointer arithmetic
- Date: Thu, 29 Feb 96 13:07:14 GMT
- Organization: none
- Message-ID: <825599234snz@genesis.demon.co.uk>
- References: <4h2r55$er@s3.iway.fr>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4h2r55$er@s3.iway.fr> assetsto@pratique.fr "Pascal Terracol" writes:
-
- > Hello,
- >
- >this sample code have been correctly working on a pc 80286 processor
- >
- >I put it on a mac and the pointers seems to act differently...
-
- "Differently" doesn't tell us very much. What were you expecting it to do?
- What did it actually do?
-
- I've had to reformat your code to make any sense of it.
-
- > int size, n1, n2 ;
- > Point *p_debut, *p1, *p2 ; /* "vecteur" de translation des adr */
- >
- >...
- >
- > n1 = (int) (l->p1)/sizeof(Point) ;
-
- What is l, in particular what is the p1 member? Why are you dividing by
- sizeof(Point)?
-
- > n2 = (int) (l->p2)/sizeof(Point) ;
-
- Similarly.
-
- > p1 = p_debut + n1 ;
- > p2 = p_debut + n1 ;
-
- Did you want p1 and p2 to be assigned the same value? Since the pointers here
- aren't used there is no way of telling how they 'act'.
-
- >...
- >
- >is there a cast solution ?
-
- Casts are not a magic cure - they often create more problems than they
- solve.
-
- >this is the "Point" structure
- >
- >typedef struct { float x, y, z ; /* coordonnes point 3d */
- > float tx, ty, tz ; /* coord. transformee 3d */
- > float px, py, pz ; /* coord. pixels fenetre2d */
- > int ix, iy ; /* coord. pixels 2d ecran */
- > int compute ; /* point calcule ? 1 oui */
- > } Point ;
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-